package com.tongguan.paypos.view;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.tongguan.paypos.R;


public class PopAdapter extends BaseAdapter {
	private Context mContext;
	private ArrayList<String> dateList = new ArrayList<String>();

	public PopAdapter(Context context) {
		this.mContext = context;
	}
	public void setData(ArrayList<String> dateList){
		this.dateList = dateList;
		notifyDataSetChanged();
	}
	public void refreshData(ArrayList<String> data, int selIndex) {
		
	}

	@Override
	public int getCount() {
		return dateList == null ? 0 : dateList.size();
	}

	@Override
	public Object getItem(int pos) {
		// return mObjects.get(pos);
		return null;
	}

	@Override
	public long getItemId(int pos) {
		return pos;
	}


	@Override
	public View getView(final int pos, View convertView, ViewGroup arg2) {
		ViewHolder holder = null;
		if (convertView == null) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(mContext).inflate(R.layout.spinner_dropdown_item, null);
			holder.text = (TextView) convertView.findViewById(R.id.tv_spinner);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		holder.text.setText(dateList.get(pos));
		return convertView;
	}
	class ViewHolder{
		TextView text;
	}
}
